<?php
App::uses('AppModel', 'Model');
/**
 * Resource Model
 *
 * @property ResourceAccess $ResourceAccess
 */
class Resource extends AppModel {

/**
 * Primary key field
 *
 * @var string
 */
	public $primaryKey = 'resource_id';

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'resource_title';

//VALIDATOIN 

public $validate = array(
			'resource_title' => array(
				'alphaNumeric' => array(
					'rule'     => array('custom', '/^[a-z0-9 ]*$/i') ,
					'message'  => 'Letters and Numbers only'
				),
				'notEmpty' => array(
					'rule' => 'notEmpty',
					'message'  => 'Office name can not be empty'
				)
			),
			'resource_description' => array(
				'alphaNumeric' => array(
					'rule'     => array('custom', '/^[a-z0-9 ]*$/i') ,
					'message'  => 'Letters and Numbers only'
				),
				'notEmpty' => array(
					'rule' => 'notEmpty',
					'message'  => 'Address can not be empty'
				)
			)
		);
	
	
	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'ResourceAccess' => array(
			'className' => 'ResourceAccess',
			'foreignKey' => 'resource_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);
	public $belongsTo = array(
		'ResourceCategory' => array(
			'className' => 'ResourceCategory',
			'foreignKey' => 'resource_category'
		)
	);
			

}
